{extend name='admin@main'}

{block name="button"}

<!-- {if auth("add")}
<button data-modal='{:url("add")}' data-title="添加培训题目" class='layui-btn layui-btn-sm layui-btn-primary'>添加培训问题</button>
{/if}

{if auth("remove")}
<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" data-confirm="确定要删除这些题目吗？" action="{:url('question/remove')}" class='layui-btn layui-btn-sm layui-btn-primary'>删除培训题目</button>
{/if}
 -->
{/block}

{block name="content"}
<style type="text/css">
    td{
        overflow: hidden;
        max-width: 120px;
        text-overflow: ellipsis;
        line-height: normal;
    }
</style>
<div class="think-box-shadow">
    {include file='question/index_search'}
    <table class="layui-table" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox nowrap'>
                <label>全选<input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
            </th>
            <th class='list-table-sort-td'>
             序号
            </th>
            <th class='text-left nowrap'>题目名称</th>
            <th class='text-left nowrap'>题目答案</th>
            {if $userinfo['db1']['authorize'] ==1 }
			 <th class='text-left nowrap'>所属公司</th>
            {/if}
            <th class='text-center nowrap'>使用状态</th>
            <th class='text-left nowrap'>添加时间</th>
            <th class='text-left nowrap'>操作选项</th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
		
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
            </td>
            <td class='list-table-sort-td'>
                <label>{$vo.id}</label>
            </td>
            <td class='text-left nowrap'>
                {php}

                   {if(strlen($vo['question'])>25){
                    echo substr($vo['question'],0,20).'......';
               }else{
                    echo $vo['question'];
                    }   
               }
                   
                {/php}
                
            </td>
            <td class='text-left nowrap'>
           <!--      题目答案: --><span class="color-blue">
                {php}
                {
                    $options = json_decode($vo['options']);
                    
                     echo "&nbsp;&nbsp;".@$options[$vo['answer']]->tik;
                    
                 }
                {/php}</span>
                <br>
                <!-- 题目选项：<strong class="color-blue"> -->

                {php}
                {
                    //$options = json_decode($vo['options']);
                    //if($options==NULL){continue;}
                    //foreach ($options as $key => $value) {
                    # code...
                    #echo $value->value;
                    //if($key>=1){
                    //echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;------选项:".@$value->tik."-".$value->name."</br>";
                //}else{

                    //echo "选项:".$value->tik."-".$value->name."</br>";
            //}
                    
                //}


        }

                {/php}
            </strong>

            </td>
            {if $userinfo['db1']['authorize'] ==1 }
			<td class='text-left nowrap'>{$vo.name|default='-'}</td>
            {/if}
            <td class='text-center nowrap'>
                {eq name='vo.status' value='0'}<span class="color-green">使用中</span>{/eq}
                {eq name='vo.status' value='1'}<span class="color-red">已禁用</span>{/eq}
            </td>
            <td class='text-left nowrap'>
                {$vo.createtime|format_datetime}
            </td>
            <td class='text-left nowrap'>

                {if auth("edit")}
                <a data-dbclick class="layui-btn layui-btn-sm" data-title="编辑题目信息" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
                {/if}

                <!--{if auth("state") and $vo.status eq 0}-->
                <!--<a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('state')}">禁 用</a>-->
                <!--{elseif auth("state") and $vo.status eq 1 }-->
                <!--<a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#0" data-csrf="{:systoken('state')}">启 用</a>-->
                <!--{/if}-->

                {if auth("
				")}
                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该题目吗？" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}" action="{:url('question/remove')}">删 除</a>
                {/if}

            </td>
        </tr>
	
        {/foreach}
        </tbody>
    </table>
<fieldset>
<legend>操作选项</legend>


{if auth("remove")}

        <div class="layui-inline padding-right-20 padding-left-8">
              <label><input style="width: 18px;height: 18px" class="think-checkbox" data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
            </div>


<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" data-confirm="确定要删除这些题目吗？" action="{:url('question/remove')}" class='layui-btn layui-btn-sm layui-btn-danger'>删 除</button>
{/if}


   <button type="button" data-reload class="layui-btn layui-btn-sm">刷 新</button>
</fieldset>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>

{/block}
